Release 10.1A: OpenEdge Getting Started:
Object-oriented Programming


Creating and destroying a class instance

You must use the NEW statement to create an instance of a class, and assign the object reference for that instance to an appropriate object reference. This statement invokes any constructor specified for the class to complete class instantiation. You are responsible for deleting (destroying) any instance of a class that you create once it is no longer needed. You can delete class instances using the DELETE OBJECT statement. This statement invokes any destructor specified for the class instance.

For more information on managing the creation and destruction of class instances, see the "Managing the object life-cycle" section. For more information on how the class hierarchy of an object is created and destroyed, see Chapter 3, " Designing Objects — Inheritance, Polymorphism, and Delegation." For more information on using the NEW statement to instantiate a class, see the "Creating a class instance using the NEW statement" section.

Comparison with procedure-based programming

Using the NEW statement to instantiate a class is roughly equivalent to running a persistent procedure using the RUN statement and setting the procedure object handle. You use the DELETE OBJECT statement to destroy both a persistent procedure and an instance of a class.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095